var http=require('http');
//服务端
//监听端口，直接返回hello world
http.createServer(function(request,response){
	response.writeHead(200,{'Content-Type':'text-plain'});
	response.end('Hello world\n');
}).listen(8124);

http.createServer(function(request,response){
	var body=[];
	response.writeHead(200, { 'Content-Type': 'text/plain' });
	response.end('Hello world\n');
	console.log(request.method);
	console.log(request.headers);

	request.on('data',function(chunk){
		body.push(chunk);
	});

	request.on('end',function(){
		body=Buffer.concat(body);
		console.log(body.toString());
	});
}).listen(8001);